package org.javaboy.vhr.service;

import org.javaboy.vhr.mapper.SendResumeMapper;
import org.javaboy.vhr.model.RespPageBean;
import org.javaboy.vhr.model.SendResume;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Locale;

@Service
public class SendResumeService {
    @Autowired
    SendResumeMapper sendResumeMapper;
    public RespPageBean getSendResume(SendResume sendResume,Integer page, Integer size){
        if(page!=null && size!=null){
            page = (page - 1) * size;
        }
        List<SendResume> data = sendResumeMapper.selectSendResume(sendResume,page,size);
        Long count = sendResumeMapper.selectCount(sendResume);
        RespPageBean bean = new RespPageBean();
        bean.setData(data);
        bean.setTotal(count);
        return bean;
    }

    public Integer addSendResume(SendResume sendResume){
        int result = sendResumeMapper.insert(sendResume);
        return result;
    }

    public Integer updateSendResume(SendResume sendResume){
        int result = sendResumeMapper.updateBySendResumeId(sendResume);
        return result;
    }

    public Integer deleteSendResume(Integer id){
        int result = sendResumeMapper.deleteBySendResumeId(id);
        return result;
    }
}
